<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/24
 * Time: 11:26
 */
session_start();

$username=$_REQUEST["username1"];
$password=$_REQUEST["password"];
$sql="select * from admin ";
$sql .="where adminName='$username' ";
$con = mysqli_connect("localhost","root","","cartoon");
if(!$con){
    die("数据库连接错误");
}
mysqli_query($con,'set names utf8');
$res = mysqli_query($con,$sql);
if($res) {
    $row = mysqli_fetch_array($res);
    if ($username == $row['adminName'] && $password = $row['passWord']) {
        $_SESSION["username1"] = $username;
        echo "<script> {window.alert('登录成功');location.href='aList.php'} </script>";

        exit;
    } else {

        echo "<script> {window.alert('用户名或密码错误，登录失败');location.href='index.html'} </script>";
        //echo "用户名和密码不正确 <a href='login.php'>点我返回登录页</a>";
        exit;
    }
}